$(document).ready(function(){
	$(document).bind('blah', function(){
		$('#content').children().remove();
		var query = getQueryParameters();
		if(!query['locale']) query['locale'] = 'en';
		$.gt.setLang(query['locale']);
		var params = {};
		if(query['include'] == 1){
			params['message'] = _('This blip will be included in export operation. To exclude the blip click:');
			params['button'] = _('exclude');
		}
		else{
			params['message'] = _('This blip will be excluded from export operation. To include the blip click:');
			params['button'] = _('include');
		}
		$('#include').tmpl(params).appendTo('#content');
		$('#ok').bind('click', function(){
			var callback = function(e){
				if(window.parent && window != window.parent && window.parent.postMessage){
					window.parent.postMessage('[{"action": "closeGwextWnd"}]', 'https://wave.google.com/');
				}
			}
			var include = query['include'] == 1 ? 0 : 1;
			$.ajax({
				url: '../service/Link/updateLink?' +
					'locale=' + encodeURIComponent(query['locale']) +
					'&waveId=' + encodeURIComponent(query['waveId']) +
					'&waveletId=' + encodeURIComponent(query['waveletId']) +
					'&blipId=' + encodeURIComponent(query['blipId']) +
					'&hash=' + encodeURIComponent(query['hash']) +
					'&include=' + include,
				dataType: 'json',
				async: false,
				success: callback
			});
		});
	})
	$.gt.load();
});